package com.sfzd5.UI.answersheet;

import com.sfzd5.exam.helplibrary.exam.answersheet.Area;

import javax.swing.*;
import java.awt.*;

public class AreaEditBar extends AnswerSheetQuestionEditBar {
    JTextField tf_title;
    Area area;
    public AreaEditBar(Area area){
        super();

        this.area = area;

        JLabel lb_name = new JLabel("题目");
        this.add(lb_name);

        tf_title = new JTextField(this.area.title);
        setTextFieldSize(tf_title);
        this.add(tf_title);
    }

    private void setTextFieldSize(JTextField tf){
        Dimension d = tf.getSize();
        d.width = 200;
        d.height = 22;
        tf.setSize(d);
        tf.setMaximumSize(d);
        tf.setMinimumSize(d);
        tf.setPreferredSize(d);
    }

    public Area getArea(){
        area.title = tf_title.getText().trim();
        return area;
    }

}
